let mongoose = require("./A-mongodb");

let petroleumSchema = mongoose.Schema({
  title: String, //加油站名字**
  pic: String, //加油站图片**
  position: [String], //加油站位置**
  welfare: String, //加油站优惠*
  ninetyFivePrice: Number, //92油价*
  ninetyTwoPrice: Number, //95油价*
  ninetyTwo: { type: Number, default: 92 }, //92#
  ninetyFive: { type: Number, default: 95 }, //95#
  distance: { type: Number, default: 5.1 }, //距离加油站的距离
  workTime: { type: String, default: "上午8:00-晚上18:00" }, //工作时间
  impression: String, //车友印象
  show: {
    type: Boolean,
    default: true,
  },
});

let citysSchema = mongoose.Schema({});

let userSchema = mongoose.Schema({
  username: String, //pc用户名
  pwd: {
    type: String,
    default: "123456",
  }, //pc密码
  super: String, //管理员
  pid: {
    type: [mongoose.Types.ObjectId],
    ref: "path_pc",
  },
  phone: {
    type: Number,
    default: "",
  },
  dept: {
    type: String,
    default: "人资",
  },
  duties: {
    type: String,
    default: "职员",
  },
  show: {
    type: Boolean,
    default: true,
  },
});

let pathSchema = mongoose.Schema({
  component: String,
  icon: String,
  id: mongoose.Types.ObjectId,
  key: mongoose.Types.ObjectId,
  name: String,
  path: String,
  redirect: String,
  pid: Number,
  flag: Boolean,
  cid: {
    type: mongoose.Types.ObjectId,
    ref: "path_pc",
  },
});

let titleSchema = mongoose.Schema({
  title: String, //大标题
  leave: Number, //等级
  cid: {
    //关联的标题数据
    type: mongoose.Types.ObjectId,
    ref: "comment",
  },
});

let commentSchema = mongoose.Schema({
  title: String, //标题
  time: Date, //发布时间
  pic: String, //图片
  uid: Object, //添加标题的用户信息
  content: String, //标题内容
  show: {
    type: Boolean,
    default: true,
  },
  tid: {
    type: mongoose.Types.ObjectId,
    ref: "title",
  },
});

let titleModel = mongoose.model("title", titleSchema, "title");

let commentModel = mongoose.model("comment", commentSchema, "comment");

let petroleumModel = mongoose.model("petroleum", petroleumSchema, "petroleum");

let pathModel = mongoose.model("path_pc", pathSchema, "path_pc");

let userModel = mongoose.model("user_pc", userSchema, "user_pc");

let citysModel = mongoose.model("citys", citysSchema, "citys");
// commentModel.create({
//   title: "市值跌破净资产！上汽究竟怎么了？股东发出灵魂拷问", //标题
//   time: "2023/07/17 20:59:00", //发布时间
//   pic: "https://www.axured.cn/assets/axurefiles/c02e557da10a6e9483f87171ba1bf676_521/images/%E6%96%87%E7%AB%A0%E8%AF%A6%E6%83%85/u2972.png", //图片
//   uid: "超级用户", //添加标题的用户信息
//   content: "111111111111111111111111111111111111111111111", //标题内容
//   classify: "汽车", //类型
// });
module.exports = {
  petroleumModel,
  titleModel,
  commentModel,
  pathModel,
  userModel,
  citysModel,
};
